package com.ruoyi.lxzx.mapper;

import java.util.List;
import com.ruoyi.lxzx.domain.GroupMember;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 老乡圈成员Mapper接口
 * 
 * @author ruoyi
 * @date 2024-10-26
 */
public interface GroupMemberMapper 
{
    /**
     * 查询老乡圈成员
     * 
     * @param id 老乡圈成员主键
     * @return 老乡圈成员
     */
    public GroupMember selectGroupMemberById(Long id);

    /**
     * 查询老乡圈成员列表
     * 
     * @param groupMember 老乡圈成员
     * @return 老乡圈成员集合
     */
    public List<GroupMember> selectGroupMemberList(GroupMember groupMember);

    /**
     * 新增老乡圈成员
     * 
     * @param groupMember 老乡圈成员
     * @return 结果
     */
    public int insertGroupMember(GroupMember groupMember);

    /**
     * 修改老乡圈成员
     * 
     * @param groupMember 老乡圈成员
     * @return 结果
     */
    public int updateGroupMember(GroupMember groupMember);

    /**
     * 删除老乡圈成员
     * 
     * @param id 老乡圈成员主键
     * @return 结果
     */
    public int deleteGroupMemberById(Long id);

    /**
     * 批量删除老乡圈成员
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteGroupMemberByIds(Long[] ids);

    @Select("select img from user_card where user_id in (SELECT user_id FROM group_member where group_id = #{id} and status = 2)" )
    List<String> findImgByGroupId(@Param("id") Long id);

    @Select("select * from group_member where group_id = #{groupId} and user_id = #{userId} and status = '1' order by create_time desc")
    GroupMember selectMemberByGroupIdAndUserId(@Param("groupId") Long groupId, @Param("userId") Long userId);
    @Select("select * from group_member where group_id = #{groupId} and user_id = #{userId} order by create_time desc")
    GroupMember selectMemberByGroupIdAndUserIdAll(@Param("groupId") Long groupId, @Param("userId") Long userId);

    void audit(GroupMember groupMember);

    List<GroupMember> selectGroupMemberList1(@Param("groupId") Long groupId);

    List<GroupMember> selectGroupMemberList2(@Param("groupId") Long groupId);
}
